package com.eportal.util;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * Created by smzhang on 2016/1/11.
 */
public class PropertiesUtil {
	private static Logger log = Logger.getLogger(PropertiesUtil.class);
    private static Properties getProperties() {
        Properties prop = new Properties();
        String savePath = PropertiesUtil.class.getClassLoader().getResource("/config.properties").getPath();
        try {
            InputStream in = new BufferedInputStream(new FileInputStream(savePath));
            prop.load(in);
        } catch (Exception e) {
        	log.error("error",e);
            return null;
        }
        return prop;
    }

    public static String getValue(String key) {
        Properties properties = getProperties();
        return properties.getProperty(key);
    }
}
